import Cookies from "js-cookie";
const TokenKey = "Admin-Token";
//  token  过期时间
const timeKey = "expireTime";

export function getToken() {
  return Cookies.get(TokenKey);
}

export function setToken(token) {
  return Cookies.set(TokenKey, token);
}

export function removeToken() {
  return Cookies.remove(TokenKey);
}

/**
 *  清除sessionStorage
 * @returns
 *
 */
export function clearStorage() {
  return sessionStorage.clear();
}

/**
 * 设置token过期时间
 * @param { } time
 */
export function setTokenTime(time) {
  return sessionStorage.setItem(timeKey, time);
}

export function getTokenTime() {
  return sessionStorage.getItem(timeKey);
}

export function removeTokenTime() {
  return sessionStorage.setItem(timeKey, 0);
}
